local UPDATEPERIOD, elapsed = 0.5, 0
local obj = LibStub("LibDataBroker-1.1"):NewDataObject("ccSpeed", {type="data source",text = "?%",label = "Speed"})
local f = CreateFrame("Frame")

f:SetScript("OnUpdate", function(self, elap)
	elapsed = elapsed + elap
	if elapsed < UPDATEPERIOD then return end

	elapsed = 0
	local speed = UnitInVehicle("player") and GetUnitSpeed("vehicle") or GetUnitSpeed("player")
	if speed then
		obj.text = math.floor(speed / 7 * 100 + 0.5).."%"
	else
		obj.text = "?%"
	end
end)
